package cn.gson.fengboot.controller;

import cn.gson.fengboot.model.pojos.*;
import cn.gson.fengboot.model.service.LwxzbService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.Serializable;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/vue")
public class LwxzbController {

    @Autowired
    LwxzbService lwxzbService;

    //查询销售费用记录
    @RequestMapping("/wxzbcx")
    @ResponseBody
    //查询所有客户服务
    public Map<String,Object> khkefu(Integer currentPage , Integer pageSize,String shijian,String lsh){
        if(currentPage==null || currentPage==' '||pageSize==null||pageSize==' '){
            currentPage=1;
            pageSize=5;
        }
        Page<Object> obj= PageHelper. startPage( currentPage, pageSize);
        List<Lwxzb> Lwxzb = lwxzbService.wxzbcx(shijian,lsh);
        Map<String,Object> map = new HashMap<>();
        map.put("total",obj.getTotal());
        map.put("row",Lwxzb);
        return map;
    }

    //维修单号
    @RequestMapping("/danhao")
    @ResponseBody
    public String danhao(){
        String a =lwxzbService.danhao();
        return a;
    }

    //联系人查询
    @RequestMapping("/lxr")
    @ResponseBody
    public List<TfylinkmanForm> lxr(Integer khname){
        return lwxzbService.lxr(khname);
    }
    //订单查询
    @RequestMapping("/ddcx")
    @ResponseBody
    public List<Zorder> ddcx(Integer ddname){
        return lwxzbService.ddcx(ddname);
    }

    //订单查询
    @RequestMapping("/cpcx")
    @ResponseBody
    public List<Zorderdetails> cpcx(Integer cpname){
        return lwxzbService.cpcx(cpname);
    }

    //主从表新增
    @RequestMapping("/addwxzcb")
    @ResponseBody
    public void  addwxd (@RequestBody Lwxzb lwxzb){
        lwxzbService.addwxd(lwxzb);
    }

    //根据工单进度查询-----待检测
    @RequestMapping("/selectdaiJianCe")
    @ResponseBody
    public List<Lwxzb> selectdaiJianCe(){
        return  lwxzbService.selectdaiJianCe();
    };

    //根据工单进度查询-----待与客户确认
    @RequestMapping("/selectdaiYvKeHuQueRen")
    @ResponseBody
    public List<Lwxzb> selectdaiYvKeHuQueRen(){
        return  lwxzbService.selectdaiYvKeHuQueRen();
    };

    //根据工单进度查询-----待维修
    @RequestMapping("/selectdaiWeiXiu")
    @ResponseBody
    public List<Lwxzb> selectdaiWeiXiu(){
        return  lwxzbService.selectdaiWeiXiu();
    };

    //根据工单进度查询-----维修中
    @RequestMapping("/selectweiXiuZhong")
    @ResponseBody
    public List<Lwxzb> selectweiXiuZhong(){
        return  lwxzbService.selectweiXiuZhong();
    };

    //根据工单进度查询-----修理完成
    @RequestMapping("/selectxiuLiWanCheng")
    @ResponseBody
    public List<Lwxzb> selectxiuLiWanCheng(){
        return  lwxzbService.selectxiuLiWanCheng();
    };

    //根据工单进度查询-----待交付
    @RequestMapping("/selectdaiJiaoFu")
    @ResponseBody
    public List<Lwxzb> selectdaiJiaoFu(){
        return  lwxzbService.selectdaiJiaoFu();
    };

    //根据工单进度查询-----已交付
    @RequestMapping("/selectyiJiaoFu")
    @ResponseBody
    public List<Lwxzb> selectyiJiaoFu(){
        return  lwxzbService.selectyiJiaoFu();
    };

    //根据工单进度查询-----已完成
    @RequestMapping("/selectyiWanCheng")
    @ResponseBody
    public List<Lwxzb> selectyiWanCheng(){
        return  lwxzbService.selectyiWanCheng();
    };


    //查询售后部门员工
    @RequestMapping("/shohouyg")
    @ResponseBody
    public Map<String,Object> shohouyg(){
        List<QempFrom> shohouyg= lwxzbService.shohouyg();
        Map<String,Object> map = new LinkedHashMap<>();
        map.put("shohouyg",shohouyg);
        return  map;
    };


    //查询售后部门员工
    @RequestMapping("/shohoubm")
    @ResponseBody
    public Map<String,Object> shohoubm(){
        List<QdepFrom> shohoubm = lwxzbService.shohoubm();
        Map<String,Object> map = new LinkedHashMap<>();
        map.put("shohoubm",shohoubm);
        return  map;
    };

}
